package o;

import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import o.kp.c;

public abstract class FragmentTransaction {
    public int ʻ;
    public int ʻॱ;
    public int ʼ;
    public int ʽ;
    ArrayList<Runnable> ʾ;
    boolean ˊॱ = true;
    public ArrayList<b> ˋ = new ArrayList();
    public boolean ˋॱ;
    public int ˎ;
    public int ˏॱ;
    public CharSequence ͺ;
    @Nullable
    public String ॱˊ;
    public ArrayList<String> ॱˋ;
    public CharSequence ॱˎ;
    public int ॱॱ;
    public boolean ॱᐝ = false;
    public int ᐝ;
    public ArrayList<String> ᐝॱ;

    public static final class b {
        public c ʻ;
        public c ʽ;
        public int ˊ;
        public int ˋ;
        public int ˎ;
        public int ˏ;
        public Fragment ॱ;
        public int ॱॱ;

        b(int i, Fragment fragment) {
            this.ˊ = i;
            this.ॱ = fragment;
            this.ʽ = c.RESUMED;
            this.ʻ = c.RESUMED;
        }

        b(int i, @NonNull Fragment fragment, c cVar) {
            this.ˊ = i;
            this.ॱ = fragment;
            this.ʽ = fragment.ꜞ;
            this.ʻ = cVar;
        }
    }

    public abstract void ˊ();

    public abstract int ˋ();

    public abstract int ˏ();

    public void ॱ(b bVar) {
        this.ˋ.add(bVar);
        bVar.ˋ = this.ˎ;
        bVar.ˎ = this.ᐝ;
        bVar.ˏ = this.ॱॱ;
        bVar.ॱॱ = this.ʼ;
    }

    @NonNull
    public FragmentTransaction ˋ(@NonNull Fragment fragment, @Nullable String str) {
        ˎ(0, fragment, str, 1);
        return this;
    }

    @NonNull
    public FragmentTransaction ˋ(@IdRes int i, @NonNull Fragment fragment) {
        ˎ(i, fragment, null, 1);
        return this;
    }

    @NonNull
    public FragmentTransaction ॱ(@IdRes int i, @NonNull Fragment fragment, @Nullable String str) {
        ˎ(i, fragment, str, 1);
        return this;
    }

    void ˎ(int i, Fragment fragment, @Nullable String str, int i2) {
        Class cls = fragment.getClass();
        int modifiers = cls.getModifiers();
        if (cls.isAnonymousClass() || !Modifier.isPublic(modifiers) || (cls.isMemberClass() && !Modifier.isStatic(modifiers))) {
            throw new IllegalStateException("Fragment " + cls.getCanonicalName() + " must be a public static class to be  properly recreated from instance state.");
        }
        if (str != null) {
            if (fragment.ˎˎ == null || str.equals(fragment.ˎˎ)) {
                fragment.ˎˎ = str;
            } else {
                throw new IllegalStateException("Can't change tag of fragment " + fragment + ": was " + fragment.ˎˎ + " now " + str);
            }
        }
        if (i != 0) {
            if (i == -1) {
                throw new IllegalArgumentException("Can't add fragment " + fragment + " with tag " + str + " to container view with no id");
            } else if (fragment.ˌ == 0 || fragment.ˌ == i) {
                fragment.ˌ = i;
                fragment.ˍ = i;
            } else {
                throw new IllegalStateException("Can't change container ID of fragment " + fragment + ": was " + fragment.ˌ + " now " + i);
            }
        }
        ॱ(new b(i2, fragment));
    }

    @NonNull
    public FragmentTransaction ˏ(@IdRes int i, @NonNull Fragment fragment) {
        return ˏ(i, fragment, null);
    }

    @NonNull
    public FragmentTransaction ˏ(@IdRes int i, @NonNull Fragment fragment, @Nullable String str) {
        if (i == 0) {
            throw new IllegalArgumentException("Must use non-zero containerViewId");
        }
        ˎ(i, fragment, str, 2);
        return this;
    }

    @NonNull
    public FragmentTransaction ˊ(@NonNull Fragment fragment) {
        ॱ(new b(3, fragment));
        return this;
    }

    @NonNull
    public FragmentTransaction ॱ(@NonNull Fragment fragment) {
        ॱ(new b(4, fragment));
        return this;
    }

    @NonNull
    public FragmentTransaction ˏ(@NonNull Fragment fragment) {
        ॱ(new b(5, fragment));
        return this;
    }

    @NonNull
    public FragmentTransaction ˋ(@NonNull Fragment fragment) {
        ॱ(new b(6, fragment));
        return this;
    }

    @NonNull
    public FragmentTransaction ˎ(@NonNull Fragment fragment) {
        ॱ(new b(7, fragment));
        return this;
    }

    @NonNull
    public FragmentTransaction ˏ(@NonNull Fragment fragment, @NonNull c cVar) {
        ॱ(new b(10, fragment, cVar));
        return this;
    }

    public boolean ʽ() {
        return this.ˋ.isEmpty();
    }

    @NonNull
    public FragmentTransaction ˏ(@Nullable String str) {
        if (this.ˊॱ) {
            this.ˋॱ = true;
            this.ॱˊ = str;
            return this;
        }
        throw new IllegalStateException("This FragmentTransaction is not allowed to be added to the back stack.");
    }

    @NonNull
    public FragmentTransaction ʻ() {
        if (this.ˋॱ) {
            throw new IllegalStateException("This transaction is already being added to the back stack");
        }
        this.ˊॱ = false;
        return this;
    }
}
